package com.github.common.extend.demo.config;

import org.apache.commons.lang3.StringUtils;

/**
 * @author wangjj7
 * @date 2024/4/22
 * @description
 */
public interface VerifyEnum<E> {

    E getVerifyValue();

    static <C ,E extends VerifyEnum<C>> E of(E[] baseEnums , String name) {
        if (baseEnums == null || StringUtils.isBlank(name)){
            return null;
        }
        for (E baseEnum : baseEnums) {
            if (name.equals(baseEnum.getVerifyValue())){
                return baseEnum;
            }
        }
        return null;
    }

}
